package com.view;

import android.databinding.DataBindingUtil;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;

import com.base.mvvm2.MVVMBaseActivity2;
import com.gml.gao.R;
import com.gml.gao.databinding.CommonRecyclviewBinding;
import com.view.Model.RecycleViewModle;
import com.view.inject.DaggerRecyclViewComponet;


/**
 * Created by gml on 17/2/21.
 */

public class RecyclViewActivity extends MVVMBaseActivity2<RecycleViewModle> {

    @Override
    protected void initInjector() {
        DaggerRecyclViewComponet.builder()
                .appComponent(getAppComponent())
                .activityModule(getActivityModule())
                .build()
                .inject(this);
    }
    @Override
    public void initView() {
        CommonRecyclviewBinding binding = DataBindingUtil.setContentView(this, R.layout.common_recyclview);
        binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));//这里用线性显示 类似于listview
//        mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));//这里用线性宫格显示 类似于grid view
//        mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(1, OrientationHelper.VERTICAL));//这里用线性宫格显示 类似于瀑布流

//        List<Employee> demoList = new ArrayList<>();
//        demoList.add(new Employee("Zhai", "Mark", false));
//        demoList.add(new Employee("Zhai2", "Mark2", false));
//        demoList.add(new Employee("Zhai3", "Mark3", true));
//        demoList.add(new Employee("Zhai4", "Mark4", false));
//        madapter.addAll(demoList);

//        binding.setLvAdapter(mPresenter.gettSimpleAdapter());

        binding.add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPresenter.findall();
            }
        });
    }
}
